#ifndef CHANGE_CAMERA_ANIMATOR_H_
#define CHANGE_CAMERA_ANIMATOR_H_

#include "CGlobals.h"
#include "position2d.h"
#include "ISceneNodeAnimator.h"

class CSceneObject;
class CCinematicCommand;

class CChangeCameraAnimator : public ISceneNodeAnimator
{
public:
	CChangeCameraAnimator(ICameraSceneNode* camera);

	bool isEventReceiverEnabled () const;
	bool OnEvent (const SEvent& event);

	void animateNode (ISceneNode* node, u32 timeMs);

	virtual ISceneNodeAnimator* createClone(ISceneNode* node,
				ISceneManager* newManager=0){ return 0; }

	void SetCameraInfo(CCinematicCommand* cmd);
	void SaveCameraInfoToCinematic();
	void resetCamera();

private:
	void setAttribute (const c8* attribute, float value);	
	void setAttribute (const c8* attribute, const irr::core::vector3df& value);	
	float getAttributeAsFloat (const c8* attribute);
	irr::core::vector3df getAttributeAsVector3D(const c8* attribute);
	
	void updateCamera();

	ICameraSceneNode* m_camera;

	CCinematicCommand* m_cmd;	

	irr::core::vector3df m_camDir;
	irr::f32 m_camDis;

	float m_yaw, m_pitch, m_roll;

	irr::core::vector3df m_targetPos;	

	irr::core::position2di m_mouseStartPos;
	bool m_leftMousePressed;
	bool m_rightMousePressed;
	bool m_middleMousePressed;

	bool m_shiftPressed;
	bool m_ctrlPressed;
};

#endif //CHANGE_CAMERA_ANIMATOR_H_
